import java.util.*;

public class Test35 {
    // 有问题（大问题）
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] ch1 = in.nextLine().toCharArray();
        char[] ch2 = in.nextLine().toCharArray();
        int m = ch1.length;
        int n = ch2.length;

        int ret = 0;
        int l1 = 0, r1 = 0;
        int l2 = 0, r2 = 0;

        if (m > n) {
            while (r1 < m && r2 < n) {
                while(r1 < m && r2 < n &&ch1[r1] != ch2[r2]){
                    r1++;
                    ret++;
                }
                while(r1 < m && r2 < n && ch1[r1] == ch2[r2]){
                    r1++;
                    r2++;
                }
            }
        }else{
            while (r1 < m && r2 < n) {
                while(r1 < m && r2 < n &&ch1[r1] != ch2[r2]){
                    r2++;
                    ret++;
                }
                while(r1 < m && r2 < n && ch1[r1] == ch2[r2]){
                    r1++;
                    r2++;
                }
            }
        }

        if(r1 != m || r2!=n ) ret+=(m-r1+n-r2);

        System.out.println(ret);
    }








    //40%
    public static void main02(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();

        int[] a = new int[n + 1];
        for (int i = 0; i <= n; i++) {
            a[i] = i;
        }

        int l = 1, r = n, ret = 0;
        while (l < r) {
            ret = a[l] + a[r];
            while (ret > m) {
                r--;
                ret--;
            }
            while (ret < m) {
                l++;
                ret++;
            }
            if (ret == m) {
                System.out.println(l + " " + r);
            }
        }

        if (n >= m) {
            System.out.println(m);
        }
    }






    // 有问题
    public static void main01(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int[] a=new int[n+1];
        for(int i=0;i<=n;i++){
            a[i]=i;
        }
        boolean[] hash=new boolean[n+1];

        int count=0;
        int i=0;
        hash[i]=true;
        while(count!=n) {
            int k=0;
            while(k!=2 && i<n){
                while(hash[i]) i++;
                if(!hash[i]) {
                    i++;
                    k++;
                }
            }   // 找到 false


            if(i >= n) i=0;
            else {
                hash[i] = true;
                count++;
            }
        }
        for(int j=0;j<=n;j++) {
            if(!hash[j]){
                System.out.println(a[j]);
                break;
            }
        }

    }
}
